home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 001-100 / 001-025 / 014 / pdterm / console.c next >
C/C++ Source or Header  |  1995-03-17  |  2KB  |  66 lines

  1. #include "term.h"
  2.  
  3. /* These functions are taken directly from the console.device chapter
  4.  * in the Amiga V1.1 ROM KERNEL manual.  See manual for documentation. */
  5.  
  6.  
  7. /* Open a console device */
  8.       int
  9. OpenConsole(writerequest,readrequest,window)
  10.       struct IOStdReq *writerequest;
  11.       struct IOStdReq *readrequest;
  12.       struct Window *window;
  13.       {
  14.             int error; 
  15.             writerequest->io_Data = (APTR) window;
  16.             writerequest->io_Length = sizeof(*window);
  17.             error = OpenDevice("console.device", 0, writerequest, 0);
  18.             readrequest->io_Device = writerequest->io_Device;
  19.             readrequest->io_Unit   = writerequest->io_Unit;
  20.                   /* clone required parts of the request */
  21.             return(error);
  22.       }
  23.  
  24. /* Output a single character to a specified console */ 
  25.  
  26.       int
  27. ConPutChar(request,character)
  28.       struct IOStdReq *request;
  29.       char character;
  30.       {
  31.             request->io_Command = CMD_WRITE;
  32.             request->io_Data = (APTR)&character;
  33.             request->io_Length = 1;
  34.             DoIO(request);
  35.             return(0);
  36.       }
  37.  
  38. /* Output a NULL-terminated string of characters to a console */ 
  39.  
  40.       int
  41. ConPutStr(request,string)
  42.       struct IOStdReq *request;
  43.       char *string;
  44.       {
  45.             request->io_Command = CMD_WRITE;
  46.             request->io_Data = (APTR)string;
  47.             request->io_Length = -1;
  48.             DoIO(request);
  49.             return(0);
  50.       }
  51.  
  52.       /* queue up a read request to a console */
  53.  
  54.       int
  55. QueueRead(request,whereto)
  56.       struct IOStdReq *request;
  57.       char *whereto;
  58.       {
  59.             request->io_Command = CMD_READ;
  60.             request->io_Data = (APTR)whereto;
  61.             request->io_Length = 1;
  62.             SendIO(request);
  63.             return(0);
  64.       }
  65.  
  66.